﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true"
    CodeBehind="Edit.aspx.cs" Inherits="MVCClubSite.Web.Views.Announcements.Edit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div class="contentblock">
        <h2>
            Edit Annoucement</h2>
            
             <%= Html.ValidationSummary() %>
             
        <% using (Html.BeginForm("Update", "Announcements", new { id = ViewData.Model.Announcement.ID }, FormMethod.Post))
           { %>
        <table border="0" cellpadding="2" cellspacing="0">
            <tr>
                <td>
                    <%= Html.Label("Title", "Title:")%>
                </td>
                <td colspan="2">
                    <%= Html.TextBox("Title", ViewData.Model.Announcement.Title, (object)new { @size = "80" }) %>
                    <%= Html.ValidationMessage("title") %>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    <%= Html.Label("Description", "Description:") %>
                </td>
                <td colspan="2">
                    <%= Html.TextArea("Description", ViewData.Model.Announcement.Description, 6, 80, null)%>
                    <%= Html.ValidationMessage("Description")%>
                </td>
            </tr>
            <tr>
                <td>
                    <%= Html.Label("articleDate", "Article Date:") %>
                </td>
                <td>
                    <%= Html.TextBox("articleDate", ViewData.Model.Announcement.AnnouncementDate.ToShortDateString(), (object)new { @size = "10" })%>
                    <%= Ajax.Calendar("articleDate") %>
                    <%= Html.ValidationMessage("announcementDate")%>
                </td>
            </tr>
            <tr>
                <td>
                    Photo Album:
                </td>
                <td colspan="2">
                    <select size="5" name="albumID" id="albumID">
                        <% if (ViewData.Model.Announcement.AlbumID == 0)
                           {%>
                        <option value="0" selected="selected">No Album Selected</option>
                        <%}
                           else
                           { %>
                        <option value="0">No Album Selected</option>
                        <%} %>
                        <% foreach (Album a in ViewData.Model.Albums)
                           { %>
                        <% if (ViewData.Model.Announcement.AlbumID == a.ID)
                           {%>
                        <%= "<option value='" + a.ID + "' selected='selected'>" + a.Title + "</option>"%>
                        <%}
                           else
                           { %>
                        <%= "<option value='" + a.ID + "'>" + a.Title + "</option>"%>
                        <%} %>
                        <%} %>
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td width="30x">
                    <input type="submit" value="Save" />
                            <% } %></td><td>
                    <% using (Html.BeginForm("Delete", "Announcements", new { id = ViewData.Model.Announcement.ID }, FormMethod.Post))
                       { %>
                    <input type="submit" value="Delete"
           <%} %>
                </td>
            </tr>
        </table>

    </div>

    <script type="text/javascript" src="<%=AppHelper.JavascriptUrl("tinymce/tiny_mce.js") %>"></script>

    <script type="text/javascript" src="<%=AppHelper.JavascriptUrl("tinymce/advanced_config.js") %>"></script>

</asp:Content>
